<?php

function GENERATE_SMTP_MAIL($mailTo, $fromEmail, $fromName, $cc='', $bcc='', $subject , $message, $ccAddress)
{
	require_once('../smtp/class.phpmailer.php');
	//error_reporting(1);
	
	$mailto = $mailTo;
	$cc = $cc;
	$bcc = $bcc;
	$email = $fromEmail;
	 
	//SMTP FUNCTION
	
	$mail  = new PHPMailer();
	$mail->IsSMTP(); // telling the class to use SMTP
	$mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
	$mail->SMTPAuth   = true;                  // enable SMTP authentication
	
	$mail->IsHTML(true);
	$mail->Host ="globaltodo.com";
	$mail->Port = 25;
	$mail->Username = "listings";
	$mail->Password = "gtdlist";
		
	$mail->SetFrom($email, $fromName);
	$mail->Subject    = $subject;
	
	//$mail->MsgHTML($message);
	
	$mail->Body = $message;
	$address = $mailto;
	$mail->AddAddress($ccAddress, $fromName);
	
	//CC added to the email sending procedure.
	$mail->AddCC($mailto,$fromName);
	
	if(!$mail->Send()) {
	  $emailerror= $mail->ErrorInfo;
	  //$emailerror = "Message sent successfully!";
	} else {
		$emailerror= $mail->ErrorInfo;
	 //$emailerror = "Message sent successfully!";
	}	
	//return $emailerror;
}